package com.fanfanwang.ffw.app.net;

import java.lang.reflect.Type;

import org.json.JSONException;

import com.fanfanwang.ffw.app.bean.SucAddParkNum;
import com.fanfanwang.ffw.app.bean.SucDelParkNum;
import com.fanfanwang.ffw.app.bean.SucGetMsgListBean;
import com.fanfanwang.ffw.app.bean.SucParkIsRegBean;
import com.fanfanwang.ffw.app.bean.SucParkNumBean;
import com.fanfanwang.ffw.app.bean.SucSetParknumStatusBean;
import com.fanfanwang.ffw.app.bean.SucSetparkNewPasswordBean;
import com.fanfanwang.ffw.app.bean.SucUserBean;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;

import android.text.TextUtils;

public class FfwParse {

//
//	public static SucMyOneYuanBean parseMyOneYuanBean(String json) {
//		// TODO Auto-generated method stub
//		Type type = new TypeToken<SucMyOneYuanBean>() {
//		}.getType();
//		SucMyOneYuanBean bean = new SucMyOneYuanBean();
//		try {
//			bean = new Gson().fromJson(json, type);
//		} catch (JsonSyntaxException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//		return bean;
//	}
	/**
	 * 登录解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucUserBean parseUser(String json) throws JSONException {
		Type type = new TypeToken<SucUserBean>() {
		}.getType();
		SucUserBean bean = new SucUserBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 登录解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucUserBean parseUserSucBean(String json) throws JSONException {
		Type type = new TypeToken<SucUserBean>() {
		}.getType();
		SucUserBean bean = new SucUserBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 用户是否已经注册，找回密码的时候。返回一个验证码
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucParkIsRegBean parseSucParkIsRegBean(String json) throws JSONException {
		Type type = new TypeToken<SucParkIsRegBean>() {
		}.getType();
		SucParkIsRegBean bean = new SucParkIsRegBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 设置商户密码
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucSetparkNewPasswordBean parseSucSetParkNewPassword(String json) throws JSONException {
		Type type = new TypeToken<SucSetparkNewPasswordBean>() {
		}.getType();
		SucSetparkNewPasswordBean bean = new SucSetparkNewPasswordBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 停车位列表解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucParkNumBean parseGetParknumList(String json) throws JSONException {
		Type type = new TypeToken<SucParkNumBean>() {
		}.getType();
		SucParkNumBean bean = new SucParkNumBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 添加停车位解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucAddParkNum parseAddParknums(String json) throws JSONException {
		Type type = new TypeToken<SucAddParkNum>() {
		}.getType();
		SucAddParkNum bean = new SucAddParkNum();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * 删除停车位解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucDelParkNum parseDelParknums(String json) throws JSONException {
		Type type = new TypeToken<SucDelParkNum>() {
		}.getType();
		SucDelParkNum bean = new SucDelParkNum();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * iv.	setParknumStatus更改停车位状态 解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucSetParknumStatusBean parseSetParknumStatus(String json) throws JSONException {
		Type type = new TypeToken<SucSetParknumStatusBean>() {
		}.getType();
		SucSetParknumStatusBean bean = new SucSetParknumStatusBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}
	/**
	 * iv.	setParknumStatus更改停车位状态 解析
	 * 
	 * @param json
	 * @return
	 * @throws JSONException
	 */
	public static SucGetMsgListBean parseGetMsgList(String json) throws JSONException {
		Type type = new TypeToken<SucGetMsgListBean>() {
		}.getType();
		SucGetMsgListBean bean = new SucGetMsgListBean();
		try {
			bean = new Gson().fromJson(json, type);
		} catch (JsonSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bean;
	}

}